/*! @File        : udpcommunicate.h
 *  @Brief       : UDP接口
 *  @Details     : 详细说明
 *  @Author      : 毛辰飞
 *  @Date        : 2024-11-18 10:48:46
 *  @Version     : v1.0
 *  @Copyright   : Copyright By 毛辰飞, All Rights Reserved
 *
 **********************************************************
 *
 *  @Attention   :
 *  @par 修改日志:
 *  <table>
 *  <tr><th>Date       <th>Version   <th>Author    <th>Description
 *  <tr><td>2024-11-18 <td>1.0       <td>毛辰飞     <td>创建初始版本
 *  </table>
 *
 *********************************************************
 */
#ifndef UDPCOMMUNICATE_H
#define UDPCOMMUNICATE_H

#include <QObject>
#include <QtNetwork>
#include <QHostAddress>

class UDPCommunicate: public QObject
{
    Q_OBJECT
public:
    explicit UDPCommunicate(QString localIp, QString remoteIp,int localPort ,int remotePort, QObject *parent = nullptr);
    ~UDPCommunicate();
private slots:
    void slot_init();
    void slot_stop();
    void slot_send(QByteArray array);
    void slot_receive();


private:
    QUdpSocket   *m_udpSocket;

    QString       m_local_ip;
    QString       m_remote_ip;
    int           m_local_port;
    int           m_remote_port;

    double m_dRecvData[500];
private:
    void _handle(const QByteArray &src);
signals:
    //void signal_UDPDIDOData(QByteArray data);
    void signal_UDPData(double dValue,int iDOAO,int iPin);

};


#endif // UDPCOMMUNICATE_H
